package com.liang.math;

public class MathDemo {
    public static void main(String[] args) {
        //Math类的使用
        //abs
        int abs = Math.abs(-10);
        System.out.println(abs);

        //ceil
        double ceil = Math.ceil(10.1);
        System.out.println(ceil);

        //floor
        double floor = Math.floor(10.9);
        System.out.println(floor);

        //round四舍五入
        long round = Math.round(10.5);
        System.out.println(round);

        //max
        int max = Math.max(10, 20);
        System.out.println(max);

        //min
        int min = Math.min(10, 20);
        System.out.println(min);

        //pow
        double pow = Math.pow(2, 3);
        System.out.println(pow);

        //random随机生成[0.0,1.0)的double数
        for (int i = 0; i < 10; i++) {
            double random = Math.random();

            System.out.println(random);
        }

    }
}
